package com.inspur.jzsxxzx.service.bsp.impl;

import com.inspur.jzsxxzx.entity.bsp.PubOrgan;
import com.inspur.jzsxxzx.mapper.bsp.PubOrganMapper;
import com.inspur.jzsxxzx.service.bsp.PubOrganService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PubOrganServiceImpl implements PubOrganService {
    
    @Autowired
    private PubOrganMapper pubOrganMapper;
    
    @Override
    public int save(PubOrgan record) {
        return pubOrganMapper.insert(record);
    }
    
    @Override
    public PubOrgan findById(String id) {
        return pubOrganMapper.selectByPrimaryKey(id);
    }
    
    @Override
    public int update(PubOrgan record) {
        return pubOrganMapper.updateByPrimaryKey(record);
    }
    
    @Override
    public int deleteById(String id) {
        return pubOrganMapper.deleteByPrimaryKey(id);
    }
    
    @Override
    public List<PubOrgan> findAll() {
        return pubOrganMapper.selectAll();
    }
    
    @Override
    public List<PubOrgan> findByCondition(PubOrgan condition) {
        return pubOrganMapper.selectByCondition(condition);
    }
    
    @Override
    public List<PubOrgan> findByPage(PubOrgan condition, int pageNum, int pageSize) {
        int offset = (pageNum - 1) * pageSize;
        return pubOrganMapper.selectByPage(condition, offset, pageSize);
    }
    
    @Override
    public int countByCondition(PubOrgan condition) {
        return pubOrganMapper.countByCondition(condition);
    }

    @Override
    public PubOrgan findByOrgCode(String orgCode) {
        return pubOrganMapper.selectByOrgCode(orgCode);
    }
}